import request from '@/utils/request'

// 工单列表
export function fetchToDoCount() {
  return request({
    url: '/workSheet/todoCount',
    method: 'get'
  })
}

// 工单列表
export function fetchList(query) {
  return request({
    url: '/workSheet/query',
    method: 'get',
    params: query
  })
}

// 工单详情
export function fetchWorkDetails(id) {
  return request({
    url: '/workSheet/detail/' + id,
    method: 'get'
  })
}

// 工单处理时间
export function fetchDealTime(id) {
  return request({
    url: '/workSheet/dealTime/' + id,
    method: 'get'
  })
}

// 查询排队中工单的数量
export function fetchQueueCount(id) {
  return request({
    url: '/workSheet/queueCount/' + id,
    method: 'get'
  })
}

// 提交工单
export function submitWork(data) {
  return request({
    url: '/workSheet/commit',
    method: 'post',
    data
  })
}

// 关闭工单
export function closeWork(data) {
  return request({
    url: '/workSheet/close',
    method: 'post',
    data
  })
}

// 认领工单
export function claimWork(data) {
  return request({
    url: '/workSheet/claim',
    method: 'post',
    data
  })
}

// 转移工单
export function transferWork(data) {
  return request({
    url: '/workSheet/transfer',
    method: 'post',
    data
  })
}

// 完成工单
export function finishWork(data) {
  return request({
    url: '/workSheet/finish',
    method: 'post',
    data
  })
}

// 提交留言
export function insertCommit(data) {
  return request({
    url: '/comment/insert',
    method: 'post',
    data
  })
}

// 沟通记录列表
export function fetchRecordList(query) {
  return request({
    url: '/comment/list',
    method: 'GET',
    params: query
  })
}

// 沟通记录列表
export function fetchOpsList() {
  return request({
    url: '/common/getOps',
    method: 'GET'
  })
}

// 获取应用环境
export function fetchAppEnvsList() {
  return request({
    url: '/server/getEnv',
    method: 'GET'
  })
}

// 获取镜像选项
export function fetchMirrorList() {
  return request({
    url: '/server/getImageOption',
    method: 'GET'
  })
}

// 获取应用分类
export function fetchAppClassifyList() {
  return request({
    url: '/deploy/appSort',
    method: 'GET'
  })
}

// 获取应用类型
export function fetchAppTypeList() {
  return request({
    url: '/deploy/appTypes',
    method: 'GET'
  })
}

// 获取开发/质量列表
export function fetchDevList() {
  return request({
    url: '/deploy/devList',
    method: 'GET'
  })
}

// 获取所有应用列表
export function fetchAllAppList() {
  return request({
    url: '/deploy/appList',
    method: 'GET'
  })
}

// 获取未接入分组发布的boot应用
export function fetchBootAppList() {
  return request({
    url: '/deploy/bootAppList',
    method: 'GET'
  })
}

// 下载文件
export function fetchDownloadFile(id) {
  return request({
    // responseType: 'blob',
    url: '/workSheet/downloadFile/' + id,
    method: 'GET'
  })
}
